package com.example.controller;

import com.example.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

// @Api(tags = "Hello 控制类")
@RestController
public class HelloController {

    @GetMapping(value = "/hello")
    public String hello() {
        return "Hello";
    }

    // 只要我们的接口中，返回值中存在实体类，他就会被扫描到ISwagger中
    @PostMapping(value = "/user")
    public User user() {
        return new User();
    }

    @ApiOperation("传参测试")
    @GetMapping("/hello2")
    public String hello2(@ApiParam("用户名") String username){
        return "hello 参数：" + username;
    }

    @ApiOperation("Post测试类")
    @GetMapping("/posttest")
    public User hello2(@ApiParam("用户名") User user){
        return user;
    }

}
